package com.heima.App;

import com.heima.dao.BookDao;
import com.heima.dao.Brand;
import com.heima.dao.UserDao;
import com.heima.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App2 {
    public static void main(String[] args) {
        //3.获取IoC容器
        ApplicationContext ctx =
                new ClassPathXmlApplicationContext("ApplicationContext.xml");

        System.out.println("-------------");

        //4.获取bean
        BookDao bookDao = (BookDao) ctx.getBean("bookDao");
        bookDao.save();

        System.out.println("-------------");

        BookService bookService = (BookService) ctx.getBean("bookService");
        bookService.save();

        System.out.println("--------------");

        UserDao userDao = (UserDao) ctx.getBean("userDao");
        userDao.save();

        System.out.println("--------------");

        Brand brandDao = (Brand) ctx.getBean("brandDao");
        brandDao.save();
    }
}
